package elephant.rpcserver;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import elephant.rpc.client.RPCClient;
import elephant.rpc.client.core.RPCServerInfo;

/**
 * 
 * @author skydu
 *
 */
public class DemoRPCClient {
	//
	private static Logger logger=LoggerFactory.getLogger(DemoRPCClient.class);
	//
	public static void main(String[] args) throws Exception {
		RPCClient rpcClient=new RPCClient();
		RPCServerInfo serverInfo=new RPCServerInfo("DemoRPCServer","127.0.0.1",5001);
		rpcClient.addRPCServerInfo(serverInfo);
		rpcClient.init();
		rpcClient.start();
		//
		DemoService demoService=rpcClient.createSyncRemote(DemoService.class,"DemoRPCServer");
		int retcode=demoService.echo("Hello Elephant!");
		logger.debug("retcode:{}",retcode);
	}
}
